import { fileURLToPath, URL } from 'node:url'

import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import AutoImport from 'unplugin-auto-import/vite'
import Components from 'unplugin-vue-components/vite'
import { ElementPlusResolver } from 'unplugin-vue-components/resolvers'
// <!-- 项目仅用于测试，如因外力泄露造成第三方损失与本人无关 -->
// https://vitejs.dev/config/
export default defineConfig({
	base:process.env.NODE_ENV === 'production'? './': '/', 
	plugins: [
		vue(),
		AutoImport({
			resolvers: [ElementPlusResolver()],
		}),
		Components({
			resolvers: [ElementPlusResolver()],
		}),
	],
	resolve: {
		alias: {
			'@': fileURLToPath(new URL('./src', import.meta.url)),
		},
	},
	server: {
		host:'0.0.0.0' ,//ip地址
		port: 5173, // 设置服务启动端口号
		open: true, // 设置服务启动时是否自动打开浏览器
	},
})
